//
//  BaseViewController.m
//  News
//
//  Created by Han on 15/7/3.
//  Copyright (c) 2015年 IPinglun. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController () {

}

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    [self drawView];
}




- (void)drawView {
    
    self.view.backgroundColor = BG_COLOR;
    
    UIView *navigationBar = UIView.new;
    navigationBar.backgroundColor = MAIN_COLOR;
    [self.view addSubview:navigationBar];
    
    UIView *parentView = self.view;
    
    [navigationBar makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(parentView.top).offset(0);
        make.left.equalTo(parentView.left).offset(0);
        make.right.equalTo(parentView.right).offset(0);
        make.height.equalTo(54);
    }];
    
    UILabel *titleLabel = UILabel.new;
    titleLabel.font = [UIFont boldSystemFontOfSize:20.0];
    titleLabel.text = @"爱评论";
    titleLabel.textColor = [UIColor whiteColor];
    [navigationBar addSubview:titleLabel];
    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(navigationBar);
        make.top.equalTo(navigationBar.top).offset(20);
        make.bottom.equalTo(navigationBar.bottom).offset(0);
    }];
    
    
    UIButton *rightButton = UIButton.new;
    rightButton.exclusiveTouch = YES;
    [rightButton addTarget:self action:@selector(showMenu) forControlEvents:UIControlEventTouchUpInside];
    [navigationBar addSubview:rightButton];
    
    [rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(navigationBar.top).offset(20);
        make.right.equalTo(parentView.right).offset(0);
        make.size.equalTo(CGSizeMake(44, 34));
    }];
    
    UIImageView *imageView = UIImageView.new;
    imageView.image = [UIImage imageNamed:@"ic_menu_light"];
    [rightButton addSubview:imageView];
    
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(rightButton);
        make.size.equalTo(CGSizeMake(24, 24));
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
